package com.wsl.mybatiscustomframe.session;

import com.wsl.mybatiscustomframe.builder.XMLConfigBuilder;
import com.wsl.mybatiscustomframe.pojo.Configuration;
import org.dom4j.DocumentException;

import java.io.InputStream;

/**
 * packageName com.wsl.mybatiscustomframe.session  SqlSessionFactoryBuilder
 *
 * @author victor
 * @version JDK 8
 * @date 2024/7/11
 * @description TODO
 */
public class SqlSessionFactoryBuilder {

    public SqlSessionFactory build(InputStream inputStream) throws DocumentException {
        // 1.解析配置文件，封装Configuration
        XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder();
        Configuration configuration = xmlConfigBuilder.parse(inputStream);
        SqlSessionFactory defatultSqlSessionFactory = new DefatultSqlSessionFactory(configuration);
        return defatultSqlSessionFactory;



    }
}
